package per.dj.testpro.entity.protocol;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import lombok.Data;

@Data
public class Res_01 implements IMessageBody{

    /**
     * 注册接口
     */
    private Byte registerRes;

    /**
     * 工作模式
     */
    private Byte workMode;

    /**
     * 鉴权码
     */
    private String registerNo;

    public final byte[] WriteToBytes() {

        ByteBuf buff = Unpooled.buffer(12);

        try{
            buff.writeByte(getRegisterRes());
            buff.writeByte(getWorkMode());
            buff.writeBytes(getRegisterNo().getBytes());
            return buff.array();
        }finally {
            if(buff != null){
                buff.release();
            }
        }
    }

    public final void ReadFromBytes(byte[] bytes) {

    }
}
